
<%@page import="com.tt.DAO.CategoryDAO"%>
<%@page import="com.tt.DAO.UserManager"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ page import="java.sql.*, com.tt.shpping.*, java.util.*" %>
<%
List<Category> categories = CategoryDAO.getCategories();
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
	<table border="1" align="center">
		<tr>
			<td>商品编号</td>
			<td>商品名</td>
			<td>父亲节点</td>
			<td>等级</td>
		</tr>
		<%
		for(Iterator<Category> cs = categories.iterator(); cs.hasNext();) {
			Category c = cs.next();
			String preStr = "";
			for(int i=1; i<c.getGrade(); i++) {
				preStr +="----";
			}
		%>
			<tr>
				<td><%=c.getId()%></td>
				<td><%=preStr+c.getName() %></td>
				<td><%=c.getPid() %></td>
				<td><%=c.getGrade() %></td>
			<td>
				<a href="categoryAdd.jsp?pid=<%=c.getId() %>" >添加子类别</a>
			</td>
			<td>
				<a href="categoryDelete.jsp?id=<%=c.getId() %>" >删除类别</a>
			</td>
			
		</tr>
		
		<%
		}
		%>
	</table>

</body>
</html>